export DATABASE_URL=sqlite:///home/coconet/code/sheisright/policy.db
rm policy.db
touch policy.db
rm users.db
cargo install sqlx-cli --no-default-features --features sqlite
cargo sqlx migrate run
cargo sqlx prepare
cargo build --release
# 创建应用目录
mkdir -p sheisright-deb/usr/local/share/sheisright

# 复制可执行文件
cp target/release/sheisright sheisright-deb/usr/local/share/sheisright/

# 复制资源文件
cp policy.db sheisright-deb/usr/local/share/sheisright/
#cp users.db sheisright-deb/usr/local/share/sheisright/
cp -r assets/ sheisright-deb/usr/local/share/sheisright/
cp -r templates/ sheisright-deb/usr/local/share/sheisright/
cp -r fonts/ sheisright-deb/usr/local/share/sheisright/
cp rbac_with_pattern_model.conf sheisright-deb/usr/local/share/sheisright/
cp rbac_with_pattern_policy.csv sheisright-deb/usr/local/share/sheisright/

cp -r DEBIAN/ sheisright-deb/
dpkg-deb --build sheisright-deb

#cargo run --release

